import homeManage from './homeManage';
import orderManage from './orderManage';
import payManage from './payManage';
// import reconcileManage from './reconcileManage';
import tenantMenage from './tenantMenage';
import settlementManage from './settlementManage';
import configManage from './configManage';
import billManage from './billManage';
import statementManage from './statementManage';
import Invoice from './invoice';
// 报表管理
import statement from './statement/routes';
const Layout = resolve => {
  require(['./Layout'], resolve);
};

const routeConfig = [
  {
    path: '/home/admin',
    redirect: '/home/admin/homeCenter',
    component: Layout,
    meta: {
      title: '首页',
      name: '首页',
      permission: 'auth:common',
      show: false,
      icon: 'md-reorder'
    },
    children: [...homeManage],
    beforeEnter: (to, from, next) => {
      next();
    }
  },
  {
    path: '/order/admin',
    redirect: '/order/admin/orderCenter',
    component: Layout,
    meta: {
      title: '订单管理',
      name: '订单管理',
      permission: 'trade:order',
      show: true,
      icon: 'md-reorder'
    },
    children: [...orderManage],
    beforeEnter: (to, from, next) => {
      next();
    }
  },
  {
    path: '/pay/admin',
    redirect: '/pay/admin/payCenter',
    component: Layout,
    meta: {
      title: '支付管理',
      name: '支付管理',
      permission: 'trade:payment',
      icon: 'logo-usd',
      show: true
    },
    children: [...payManage],
    beforeEnter: (to, from, next) => {
      next();
    }
  },
  // {
  //   path: '/reconcile/admin',
  //   redirect: '/reconcile/admin/reconcileCenter',
  //   component: Layout,
  //   meta: {
  //     title: '对账管理',
  //     name: '对账管理',
  //     icon: 'md-copy',
  //     show: true
  //   },
  //   children: [...reconcileManage],
  //   beforeEnter: (to, from, next) => {
  //     next();
  //   }
  // },
  {
    path: '/tenant/admin',
    redirect: '/tenant/admin/tenantCenter',
    component: Layout,
    meta: {
      title: '商户中心',
      name: '商户中心',
      permission: ['trade:merchant'],
      icon: 'md-copy',
      show: true
    },
    children: [...tenantMenage],
    beforeEnter: (to, from, next) => {
      next();
    }
  },
  {
    path: '/bill/admin',
    redirect: '/bill/admin/billCenter',
    component: Layout,
    meta: {
      title: '账单管理',
      name: '账单管理',
      permission: 'trade:settlement:bill',
      icon: 'md-card',
      show: true
    },
    children: [...billManage],
    beforeEnter: (to, from, next) => {
      next();
    }
  },
  {
    path: '/settlement/admin',
    redirect: '/settlement/admin/settlementCenter',
    component: Layout,
    meta: {
      title: '对账管理',
      name: '对账管理',
      permission: 'trade:settlement:settleManage',
      icon: 'md-calculator',
      show: true
    },
    children: [...settlementManage],
    beforeEnter: (to, from, next) => {
      next();
    }
  },
  {
    path: '/config/admin',
    redirect: '/config/admin/configCenter',
    component: Layout,
    meta: {
      title: '配置管理',
      name: '配置管理',
      permission: 'trade:common:config',
      icon: 'md-build',
      show: true
    },
    children: [...configManage],
    beforeEnter: (to, from, next) => {
      next();
    }
  },
  {
    path: '/statement/admin',
    redirect: '/statement/admin/statementCenter',
    component: Layout,
    meta: {
      title: '报表统计',
      name: '报表统计',
      permission: 'trade:settlement:reportStatistics',
      icon: 'md-build',
      show: true
    },
    children: [...statementManage],
    beforeEnter: (to, from, next) => {
      next();
    }
  },
  ...Invoice,
  {
    path: '/statementManage',
    component: Layout,
    meta: {
      title: '报表管理',
      name: '报表管理',
      permission: 'trade:settlement:report',
      icon: 'md-analytics',
      show: true
    },
    children: [...statement]
  }
];

window.routeConfig = routeConfig;
export default routeConfig;
